package com.oc.mba.util;

import org.apache.commons.codec.digest.DigestUtils;


/**
 * @file MD5.java
 * @brief (用于文件的简易说明)
 * 
 *        详细说明...
 * 
 * @author Administrator
 * 
 * @date 2012-12-4 下午08:13:43
 * 
 * @version 1.0.0
 * 
 * @warning
 * 
 * @par 需求
 * 
 *      Revision History - 2012-12-4: change content for what reason -
 *      2012-12-4: change content for what reason
 ****************************************************************************************/
public class MD5 {
	public static String className = MD5.class.getName();

	public static void main(String args[]) {
////		String data = encryptHex("123_201212042038004");
//		// 123_201212042038004\
//		// 1a219c156ac6df2eef5efae1e549c02e
////		SysLog.info(className, data);
////		SysLog.info(className, "md5:" + DigestUtils.md5("1111:"));
//		
		String hexRandom = DESEncrypt.createDESKeyByLength(6);
//		hexRandom = "NW" + hexRandom;
		
		String md5String = hexRandom + encryptHex("NW" + hexRandom);
		System.out.println(md5String);
	}

	public static String encryptHex(String data) {
		return DigestUtils.md5Hex(data);
	}

	public static byte[] encrypt(String data) {
		return DigestUtils.md5(data);
	}

}
